// pages/fuli/advert/advert.js
var app = getApp();
var Crypto = require('../../../utils/cryptojs/cryptojs.js').Crypto;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    advert:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.advertInfoList();
  },

  advertInfoList: function() {
    var that = this;
    console.log("sdjlkdjlkasjdlkfjlsdkjflksdjlfjsdlkjflksdjflksdjfkls ")
    wx.getStorage({
      key: 'token',
      success: function (res) {
        var token = res.data;
        var timestamp = app.timestamp();
        var url = app.globalData.localApi + "/advert/advertInfo";
        wx.request({
          url: url,
          method: 'POST',
          data: {
            token: token,
            timestamp: timestamp,
            sign: Crypto.MD5(app.sign(url, token, timestamp)),
            url: app.urlStr(url),
          },
          success: function (res) {
            console.log(res)
            if(res.data.code==0){
              that.setData({
                advert:res.data.data
              })
            }

          }
        })
      },
    })
  },
  toshopShare:function(e){
    var that = this;
    var orderno = e.currentTarget.dataset.orderno
    wx.navigateTo({
      url: '../shopShare/shopShare?style=1&orderno=' + orderno,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})